<template>
  <div>
    <Head></Head>
    <!-- <h2>这里是首页的路由 --- home ----</h2> -->
    <van-search v-model="value" placeholder="请输入搜索关键词" />

    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(l, i) in list" :key="i">
        <van-image :src="l.img" class="g-img"></van-image>
      </van-swipe-item>
    </van-swipe>

    <ul class="ulist">
      <li>WOMEN</li>
      <li>MEN</li>
      <li>KIDS</li>
      <li>BABY</li>
    </ul>

    <div class="dlist">
      <ul>
        <li>热销TOP榜</li>
        <li>母.婴.童精选</li>
        <li>新作商品</li>
        <li>限时特优</li>
        <li>特大/特小尺码</li>
        <li>旗舰店</li>
      </ul>
      <div class="dtxt">About LiftWear</div>
    </div>

    <p class="xp">新作商品</p>
    <div class="onegoods" v-for="(l, i) in list2" :key="i">
      <div class="left">
        <img :src="l.goodsimg" alt="" />
      </div>
      <div class="right">
        <h3>{{ l.goodsname }}</h3>
        <p>{{ l.type }}</p>
        <p>￥{{ l.goodsprice }}</p>
        <p>限时特优</p>
        <p class="preprice">初上市价格￥{{ l.preprice }},活动截止2021/5/9</p>
      </div>
    </div>

    <div class="re-content">
      <div
        class="li"
        v-for="(l, i) in list1"
        :key="i"
        @click="gotodetail(l.id)"
      >
        <img :src="l.goodsimg" alt="" />
        <p class="type">{{ l.type }}</p>
        <p class="name">{{ l.goodsname }}</p>
        <p class="price">￥{{ l.goodsprice }}</p>
        <p class="teyou">限时特优</p>
        <p class="preprice">初上市价格￥{{ l.preprice }}</p>
      </div>
    </div>

    <div class="lifebox">
      <h2>优衣库舒适生活系列</h2>
      <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item v-for="(l, i) in list3" :key="i">
          <van-image :src="l.img" class="g-img"></van-image>
        </van-swipe-item>
      </van-swipe>
      <div class="btnbox">
        <div class="btn">查看更多舒适生活系列</div>
      </div>
    </div>

    <div class="footer">
      <p>关于优衣库</p>
       <van-row class="mine-bottom">
        <van-cell-group>
          <van-cell title="优衣库宣言" is-link />
          <van-cell title="优衣库抗疫行动" is-link />
          <van-cell title="企业公服.企业福利.企业团购优惠" is-link />
          <van-cell title="免费修改裤长" is-link />
          <van-cell title="关于警惕不法分子冒充优衣库行骗公告" is-link />
        </van-cell-group>
      </van-row>
    </div>

<div class="kong"></div>
    
    
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      film: null,
      value: "",
      list: [],
      list1: [],
      list2: [],
      list3: [],
      uid: 8,
      //   banner: [
      //     { pic: require("@/assets/images/aaa.jpg") },
      //     { pic: require("@/assets/images/bbb.png") },
      //     { pic: require("@/assets/images/ccc.jpg") },
      //     { pic: require("@/assets/images/ddd.jpg") },
      //   ],
    };
  },
  methods: {
    pik(l) {
      // this.$route.push(name:"deail",params:{index:l})
    },
  },
  mounted() {
    axios.get("http://localhost:2101/bannerlist1").then((res) => {
      console.log(res);
      this.list = res.data;
    });

    axios.get("http://localhost:2101/bannerlist2").then((res) => {
      console.log(res);
      this.list3 = res.data;
    });

    axios.get("http://localhost:2101/goodslist?q=衬衫").then((res) => {
      console.log(res);
      this.list1 = res.data;
    });

    axios.get(`http://localhost:2101/goodslist?id=${this.uid}`).then((res) => {
      console.log(res);
      this.list2 = res.data;
    });
  },
};
</script>

<style lang="scss" scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.my-swipe {
  width: 100%;
  height: 360px;
}
.g-img {
  width: 100%;
  height: 100%;
}

.ulist {
  background: #fff;
  width: 100%;
  height: 80px;
  margin-top: 10px;
  li {
    font-size: 20px;
    font-weight: 600;
    width: 25%;
    line-height: 80px;
    text-align: center;
    float: left;
    border-left: 0.5px solid #b9b9b9;
    &:nth-child(1) {
      border-left: none;
    }
  }
}
.dlist {
  height: 200px;
  margin-top: 10px;
  margin-bottom: 10px;
  background: #fff;
  ul {
    width: 100%;
    height: 150px;
    li {
      float: left;
      width: 50%;
      height: 50px;
      line-height: 50px;
      text-align: center;
      font-size: 16px;
      font-weight: 600px;
      border-left: 0.5px solid #b9b9b9;
      border-bottom: 0.5px solid #b9b9b9;
      &:nth-child(2n-1) {
        border-left: none;
      }
    }
  }
  .dtxt {
    width: 100%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 16px;
    font-weight: 600px;
    border-bottom: 0.5px solid #b9b9b9;
  }
}

.xp {
  font-size: 20px;
  line-height: 50px;
  font-weight: 600px;
  background: #fff;
  padding: 0 15px;
  font-weight: bold;
}

.onegoods {
  width: 100%;
  height: 200px;

  margin-top: 10px;
  .left {
    float: left;
    width: 55%;
    height: 100%;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .right {
    float: left;
    width: 45%;
    height: 100%;
    text-align: left;
    padding: 10px 0 0 10px;
    h3 {
      margin-top: 10px;
      font-weight: 700;
      font-size: 18px;
      color: #000;
    }
    p {
      font-size: 16px;
      color: #333;
      &:nth-child(2) {
        color: #333;
        margin-top: 3px;
        margin-bottom: 3px;
      }
      &:nth-child(3) {
        font-size: 18px;
        color: #ff0000;
        font-weight: bold;
      }
      &:nth-child(4) {
        font-size: 16px;
        color: #ff0000;
        margin-top: 3px;
        margin-bottom: 25px;
      }
      &:nth-last-child(1) {
        font-size: 10px;
        color: #333;
        margin-top: 3px;
      }
    }
  }
}

.re-content {
  width: 100%;
  height: 270px;
  display: flex;
  overflow-x: auto;
  margin-top: 10px;
  margin-bottom: 15px;
  .li {
    width: 131px;
    height: 270px;
    text-align: left;
    background: #fff;
    &:not(:last-child) {
      margin-right: 10px;
    }
    img {
      width: 131px;
      height: 131px;
    }
    p {
      font-size: 12px;
      color: #1b1b1b;
      padding: 0 5px;
      margin-bottom: 5px;
    }
    .type {
      margin-top: 5px;
    }
    .price {
      font-size: 18px;
      color: #ff0000;
      font-weight: bold;
    }
    .teyou {
      color: #ff0000;
    }
  }
}

.lifebox {
  background: #fff;
  h2 {
    font-size: 20px;
    line-height: 50px;
    font-weight: 600px;
    color: #333;
    font-weight: bold;
    margin-left: 10px;
    margin-bottom: 5px;
  }
  .btnbox {
    margin-top: 10px;
    width: 100%;
    height: 50px;
    position: relative;
    .btn {
       width: 80%;
      height: 35px;
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      right: 0;
      margin: auto;
      border: 1px solid #1b1b1b;
      text-align: center;
      line-height: 35px;
      font-size: 18px;
      font-weight: 600px;
      font-weight: bold;
      color: #333;
    }
  }
}

.footer{
  margin-top: 15px;
  background: #fff;
  width: 100%;
  p{
    font-size: 18px;
    line-height: 50px;
      color: #333;
      font-weight: bold;
      margin-left: 15px;
  }
}
 .kong {
    width: 100%;
    height: 100px;
  }
</style>